/// id : "615758053576413184"
/// userId : "615163642102550528"
/// totalPrice : "49.00"
/// realPrice : "49.00"
/// receiverAddress : "北京市北京城区东城区asdgasdg"
/// receiverName : "wujinaming"
/// receiverPhone : "14566664543"
/// payType : null
/// payTime : null
/// status : "non_pay"
/// createTime : "2025-08-27 04:02:40"
/// updateTime : "2025-08-27 04:02:40"
/// products : [{"id":"615758053597384704","createTime":"2025-08-27 04:02:40","updateTime":"2025-08-27 04:02:40","orderId":"615758053576413184","productId":"1940054302298071042","title":"凤凰架构：构建可靠的大型分布式系统","coverAddr":"product-cover:fenix.png","quantity":1}]

class Order {
  Order({
      this.id, 
      this.userId, 
      this.totalPrice, 
      this.realPrice, 
      this.receiverAddress, 
      this.receiverName, 
      this.receiverPhone, 
      this.payType, 
      this.payTime, 
      this.status, 
      this.createTime, 
      this.updateTime, 
      this.products,});

  Order.fromJson(dynamic json) {
    id = json['id'];
    userId = json['userId'];
    totalPrice = json['totalPrice'];
    realPrice = json['realPrice'];
    receiverAddress = json['receiverAddress'];
    receiverName = json['receiverName'];
    receiverPhone = json['receiverPhone'];
    payType = json['payType'];
    payTime = json['payTime'];
    status = json['status'];
    createTime = json['createTime'];
    updateTime = json['updateTime'];
    if (json['products'] != null) {
      products = [];
      json['products'].forEach((v) {
        products?.add(Product.fromJson(v));
      });
    }
  }
  String? id;
  String? userId;
  String? totalPrice;
  String? realPrice;
  String? receiverAddress;
  String? receiverName;
  String? receiverPhone;
  dynamic payType;
  String? payTime;
  String? status;
  String? createTime;
  String? updateTime;
  List<Product>? products;


  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['userId'] = userId;
    map['totalPrice'] = totalPrice;
    map['realPrice'] = realPrice;
    map['receiverAddress'] = receiverAddress;
    map['receiverName'] = receiverName;
    map['receiverPhone'] = receiverPhone;
    map['payType'] = payType;
    map['payTime'] = payTime;
    map['status'] = status;
    map['createTime'] = createTime;
    map['updateTime'] = updateTime;
    if (products != null) {
      map['products'] = products?.map((v) => v.toJson()).toList();
    }
    return map;
  }

  Order copyWith({
    String? id,
    String? userId,
    String? totalPrice,
    String? realPrice,
    String? receiverAddress,
    String? receiverName,
    String? receiverPhone,
    dynamic payType,
    String? payTime,
    String? status,
    String? createTime,
    String? updateTime,
    List<Product>? products,
  }) {
    return Order(
      id: id ?? this.id,
      userId: userId ?? this.userId,
      totalPrice: totalPrice ?? this.totalPrice,
      realPrice: realPrice ?? this.realPrice,
      receiverAddress: receiverAddress ?? this.receiverAddress,
      receiverName: receiverName ?? this.receiverName,
      receiverPhone: receiverPhone ?? this.receiverPhone,
      payType: payType ?? this.payType,
      payTime: payTime ?? this.payTime,
      status: status ?? this.status,
      createTime: createTime ?? this.createTime,
      updateTime: updateTime ?? this.updateTime,
      products: products ?? this.products,
    );
  }
}

/// id : "615758053597384704"
/// createTime : "2025-08-27 04:02:40"
/// updateTime : "2025-08-27 04:02:40"
/// orderId : "615758053576413184"
/// productId : "1940054302298071042"
/// title : "凤凰架构：构建可靠的大型分布式系统"
/// coverAddr : "product-cover:fenix.png"
/// price : "49.00"
/// quantity : 1

class Product {
  Product({
      this.id, 
      this.createTime, 
      this.updateTime, 
      this.orderId, 
      this.productId, 
      this.title, 
      this.coverAddr, 
      this.price, 
      this.quantity,});

  Product.fromJson(dynamic json) {
    id = json['id'];
    createTime = json['createTime'];
    updateTime = json['updateTime'];
    orderId = json['orderId'];
    productId = json['productId'];
    title = json['title'];
    coverAddr = json['coverAddr'];
    price = json['price'];
    quantity = json['quantity'];
  }
  String? id;
  String? createTime;
  String? updateTime;
  String? orderId;
  String? productId;
  String? title;
  String? coverAddr;
  String? price;
  int? quantity;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['createTime'] = createTime;
    map['updateTime'] = updateTime;
    map['orderId'] = orderId;
    map['productId'] = productId;
    map['title'] = title;
    map['coverAddr'] = coverAddr;
    map['price'] = price;
    map['quantity'] = quantity;
    return map;
  }

}